package com.code.leetcode.offer;

import java.util.Arrays;
import java.util.HashSet;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/6 15:54
 */
public class The61_巧妙的减法 {
    public boolean isStraight(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        int max = 0, min = 14;
        for (int num : nums) {
            if (num == 0) continue;
            max = Math.max(max, num);
            min = Math.min(min, num);
            if (set.contains(num)) return false;
            set.add(num);
        }
        return max - min < 5;
    }
}
